using System;

class TrapezoidArea
{
	static void Main()
	{
		//Write an expression that calculates trapezoid's area by given sides a and b and height h.
		Console.WriteLine("Input A:");
		double sideA;
		bool isValidA = double.TryParse(Console.ReadLine(), out sideA);
		while(isValidA==false || sideA<=0)
		{
			Console.WriteLine("Wrong Input!");
			Console.WriteLine("Input A:");
			isValidA = double.TryParse(Console.ReadLine(),out sideA);
		}
		double sideB;
		Console.WriteLine("Input B:");
		bool isValidB = double.TryParse(Console.ReadLine(), out sideB);
		while(isValidB==false || sideB<=0)
		{
			Console.WriteLine("Wrong Input!");
			Console.WriteLine("Input B:");
			isValidB = double.TryParse(Console.ReadLine(),out sideB);
		}
		double height;
		Console.WriteLine("Input Height:");
		bool isValidHeight = double.TryParse(Console.ReadLine(), out height);
		while(isValidHeight==false || height<=0)
		{
			Console.WriteLine("Wrong Input!");
			Console.WriteLine("Input Height:");
			isValidHeight = double.TryParse(Console.ReadLine(),out height);
		}
		
		
		double area = ((sideA + sideB ) /2) * height;
		Console.WriteLine("Area of trapezoid with given sides A: {0} and B: {1} and height: {2} is {3} ", sideA, sideB, height, area);
	}
}